package com.beverages.holder.client;

import com.beverages.holder.common.Result;
import com.beverages.holder.config.FeignOkHttpConfig;
import com.beverages.holder.entity.dto.intermediate.OrdersDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "merchant-orders-service", url = "${merchant.orders.service.url}", configuration = FeignOkHttpConfig.class)
public interface MerchantOrdersClient {

    @GetMapping("/merchant/orders/pending/{capacity}")
    Result<List<Integer>> getPendingOrdersIds(@PathVariable("capacity") Integer capacity);

    @GetMapping("/merchant/orders/update-completion-status")
    Result updateCompletionStatus(
            @RequestParam(name = "orderId") Integer orderId,
            @RequestParam(name = "completionStatus") Integer completionStatus);

    @GetMapping("/merchant/orders//update-place-status")
    Result updatepPlaceStatus(
            @RequestParam(name = "orderId") Integer orderId,
            @RequestParam(name = "placeStatus") Integer placeStatus);

    @GetMapping("/merchant/orders/{orderId}")
    Result<OrdersDTO> findOneOrderDTO(@PathVariable("orderId") Integer orderId);

    @GetMapping("/merchant/orders/fill-holder")
    Result fillHolderIds(
            @RequestParam(name = "orderId") Integer orderId,
            @RequestParam(name = "holderId") Integer holderId);

    @GetMapping("/merchant/orders/empty-holder")
    Result emptyHolderIds(
            @RequestParam(name = "orderId") Integer orderId,
            @RequestParam(name = "holderId") Integer holderId);

}
